import Vue from "vue";

import App from "./App.vue";

import VueRouter from "vue-router";
import Home from "./Home.vue";
import HomeFirst from "./HomeFirst.vue";
import HomeFirstOne from "./HomeFirstOne.vue";
import HomeFirstTwo from "./HomeFirstTwo.vue";
import HomeSecond from "./HomeSecond.vue";
import User from "./User.vue";
import Shop from "./Shop.vue";

Vue.use(VueRouter); //插件

// http://localhost:8080/#/shop/300/row/500
// http://localhost:8080/shop/300/row/500

const router = new VueRouter({
  // mode: "history",
  routes: [
    {
      path: "/",
      redirect: { name: "home" },
    },
    {
      path: "/home",
      redirect: { name: "user" },
      name: "home",
      component: Home,
    },
    {
      path: "/user/a/c/d/f",
      alias: "/user",
      name: "user",
      component: User,
    },
    { path: "/shop/:id/row/:rid", name: "shop", component: Shop, props: true },
  ],
});

new Vue({
  render: (h) => h(App),
  router, //路由注入
}).$mount("#app");
